<template>
  <div class="share">
    <van-nav-bar left-arrow title="面试经验" @click-left="back"> </van-nav-bar>
    <van-search
      v-model="value"
      placeholder="请输入搜索关键词"
      @click="searchShare"
    />
    <div>
      <!-- <div class="for" v-for="(item, index) in list" :key="index">

        <div @click="gotoShare(item.id)">
          <h3 class="title">{{ item.title }}</h3>
          <p class="txt">{{ item.content }}</p>
        </div>
        <div class="box">
          <div class="left">
            <img
              class="imgs"
              :src="`http://159.75.209.145:1337${item.author.avatar}`"
              alt=""
            />
            <span>{{ item.author.nickname }}</span>
          </div>
          <div class="right">
            <span class="span1">2020.06.29</span>
            <span class="iconfont iconicon_pinglunliang"></span>
            <span class="iconfont iconbtn_dianzan_small_nor"></span>
          </div>
        </div>
      </div> -->
      <ShareList></ShareList>
    </div>
  </div>
</template>

<script>
import { articlesShare } from '@/api/find.js'
import ShareList from './components/shareList.vue'

export default {
  components: {
    ShareList
  },
  name: 'shareList',
  data () {
    return {
      value: '',
      list: [],
      form: {
        start: 0,
        q: ''
      }
    }
  },
  created () {
    this.getData()
  },
  methods: {
    async getData () {
      const res = await articlesShare(this.form)
      // console.log(res)
      this.list = res.data.list
      // console.log(this.list)
      this.$toast.loading({ message: '加载中' })
      this.$nextTick(() => {
        this.$toast.clear()
      })
    },
    gotoShare (id) {
      this.$router.push('./sharedetail?id=' + id)
    },
    back () {
      this.$router.push('/find')
    },
    searchShare () {
      this.$router.push('./searchshare')
    }
  }
}
</script>

<style lang="less" scoped>
.shareList {
  padding: 32px;
  .for {
    margin-bottom: 32px;
  }
  .title {
    font-weight: 500;
    color: #181a39;
    font-size: 36px;
  }
  p {
    margin-top: 24px;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
  .txt {
    font-size: 26px;
    color: #545671;
  }
  .box {
    margin-top: 24px;
    display: flex;
    font-size: 24px;
    .left {
      flex: 1;
      position: relative;
      span {
        position: absolute;
        top: 14px;
        left: 72px;
      }
      .imgs {
        width: 48px;
        height: 48px;
        border-radius: 50%;
      }
    }
    .right {
      flex: 1;
      .span1 {
        padding-right: 42px;
      }
      .iconfont {
        padding-right: 60px;
      }
    }
  }
}
</style>
